package com.frame.interceptor

import javax.ws.rs.WebApplicationException
import javax.ws.rs.ext.ReaderInterceptor
import javax.ws.rs.ext.ReaderInterceptorContext
import java.util.zip.GZIPInputStream

/**
 * Created by three on 14-7-30.
 */
class GZIPReaderInterceptor implements ReaderInterceptor {
    @Override
    Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException {
        final InputStream originalInputStream = context.getInputStream();
        context.setInputStream(new GZIPInputStream(originalInputStream));
        return context.proceed();
    }
}
